/**********************************************************************************************************************
 * SplendidCRM is a Customer Relationship Management program created by SplendidCRM Software, Inc. 
 * Copyright (C) 2005-2011 SplendidCRM Software, Inc. All rights reserved.
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the 
 * GNU Affero General Public License as published by the Free Software Foundation, either version 3 
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with this program. 
 * If not, see <http://www.gnu.org/licenses/>. 
 * 
 * You can contact SplendidCRM Software, Inc. at email address support@splendidcrm.com. 
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3, 
 * the Appropriate Legal Notices must display the following words on all interactive user interfaces: 
 * "Copyright (C) 2005-2011 SplendidCRM Software, Inc. All rights reserved."
 *********************************************************************************************************************/
using System;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace SplendidCRM._controls
{
	/// <summary>
	///		Summary description for DetailNavigation.
	/// </summary>
	public partial class DetailNavigation : SplendidControl
	{
		protected Guid       gID             = Guid.Empty;
		protected string     sModule         = String.Empty;

		public string Module
		{
			get
			{
				return sModule;
			}
			set
			{
				sModule = value;
			}
		}

		public bool ShowChangeLog
		{
			get
			{
				return lnkViewChangeLog.Visible;
			}
			set
			{
				lnkViewChangeLog.Visible = value;
			}
		}

		protected void Page_Load(object sender, System.EventArgs e)
		{
			gID = Sql.ToGuid(Request["ID"]);
			// 11/09/2009 Paul.  The offline client does not support auditing. 
			int nAuditExists = Sql.ToInteger(Application["Audit.Exists"]);
			if ( nAuditExists == 0 )
			{
				nAuditExists = -1;
				// 01/20/2010 Paul.  Needed to map the path before checking if it exists. 
				if ( System.IO.File.Exists(Server.MapPath("~/Audit/Popup.aspx")) )
					nAuditExists = 1;
				Application["Audit.Exists"] = nAuditExists;
			}
			lnkViewChangeLog.Visible    = (nAuditExists == 1) && Sql.ToBoolean(Application["Modules." + sModule + ".Audited"     ]);
			lnkReturnToList.NavigateUrl = Sql.ToString (Application["Modules." + sModule + ".RelativePath"]) + "default.aspx";
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
		}
		#endregion
	}
}


